home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue30 / corner / LISTING2.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1998-01-09  |  773 b   |  30 lines

  1. unit clFoo;
  2. interface
  3. Uses SysUtils;
  4. Type
  5.   TCaptionType = (ctNormal,ctAbbrev,ctUpper,ctCapital);
  6.   TFoo = class
  7.   protected
  8.     function GetCaption(const value: string; opt: TCaptionType): string;
  9.   public
  10.     property Caption[const value: string; opt: TCaptionType]: string read GetCaption;
  11.   end;
  12. var Foo: TFoo;
  13. implementation
  14. function TFoo.GetCaption(const value: string; opt: TCaptionType): string;
  15. begin
  16.   if value='' then Result := ''
  17.   else begin
  18.     case opt of
  19.        ctNormal: Result := value;
  20.        ctAbbrev: Result := Copy(value,1,8);
  21.         ctUpper: Result := Uppercase(value);
  22.       ctCapital: Result := UpCase(value[1])+Copy(value,2,255);
  23.     end;
  24.   end;
  25. end;
  26. initialization
  27.   Foo := TFoo.Create;
  28. finalization
  29.   Foo.Free;
  30. end.